USE [thoitrang]
GO
/****** Object:  StoredProcedure [dbo].[a_Users_sel]    Script Date: 10/27/2008 14:20:34 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
	
/******************************************************************************
**		File: 
**		Name: [dbo].a_Users_sel
**		Desc: 
**
**		Return values:
** 
**		Called by:   
**              
**		Parameters:
**		Input							Output
**     ----------							-----------
**
**		Auth: CodeSmith
**		Date: 1/8/2009 9:07:00 PM
*******************************************************************************
**		Change History
*******************************************************************************
**		Date:		Author:				Description:
**		--------		--------				-------------------------------------------
**    
*******************************************************************************/
CREATE PROCEDURE [dbo].[a_Users_selByEmail]
	@Email varchar(50)
AS

SELECT
	[UserID],
	[CookieID],
	[Login_Email],
	[EmailConfirmed],
	[Password],
	[Firstname],
	[Lastname],
	[Title],
	[Gender],
	[Visits],
	[Hits],
	[LastVisit],
	[DateOpen],
	[UserTypeID],
	[IsActive],
	[CarID],
	[IsAccessFeatured]
FROM
	[dbo].[a_Users]
WHERE
	[Login_Email] = @Email


	
/*******************************************************************************
**		Date:		Author:				Description:
**		--------		--------				-------------------------------------------
**    
*******************************************************************************/	
CREATE PROCEDURE [dbo].[a_Users_selByCkid]
	@Ckid varchar(50)
AS

SELECT
	[UserID],
	[CookieID],
	[Login_Email],
	[EmailConfirmed],
	[Password],
	[Firstname],
	[Lastname],
	[Title],
	[Gender],
	[Visits],
	[Hits],
	[LastVisit],
	[DateOpen],
	[UserTypeID],
	[IsActive],
	[CarID],
	[IsAccessFeatured]
FROM
	[dbo].[a_Users]
WHERE
	[CookieID] = @Ckid	
	
/*******************************************************************************
**		Date:		Author:				Description:
**		--------		--------				-------------------------------------------
**    
*******************************************************************************/	
CREATE PROCEDURE [dbo].[a_Users_selBySSID]
	@SSID varchar(50)
AS
DECLARE @Ckid varchar(50)
SELECT @Ckid = a.CookieID FROM a_Sessions a WHERE a.SessionID=@SSID
EXEC a_Users_selByCkid @Ckid